package com.lie.prepare.multi_thread.specialLock;

/**
 * Created by lie on 2018/4/10.
 */
public class Fat {
    private volatile double d;//阻止优化？
    private static int counter = 0;
    private final int id = counter++;

    public Fat(){
        //模拟一种，创建fat实例代价比较高的情况
        for (int i = 0; i < 10000; i++) {
            d += (Math.PI + Math.E) / (double)i;
        }
    }

    public void operation(){
        System.out.println(this);
    }

    @Override
    public String toString() {
        return "Fat{" +
                "id=" + id +
                '}';
    }
}
